function createScript(){
	// let channel = gameChannelId === 2182?"5653325003":"6774834986";
	// console.log(channel,'channel')
	// var script = document.createElement("script");
	// document.head.append(script);
	// script.async = 'async';
	// script.setAttribute("data-ad-client","ca-pub-1727029308377024");
	// script.setAttribute("data-ad-channel","7939331742"); //2628
	// script.setAttribute("data-adbreak-test","on");
	// script.setAttribute("data-ad-frequency-hint","30s");
	// script.src = 'https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js';
}

function adPrepare(){
	window.adsbygoogle = window.adsbygoogle || [];
	window.adBreak = window.adConfig = function (o) {
		adsbygoogle.push(o);
	}
	// adConfig({preloadAdBreaks: 'on'})
}


function openAd(toUrl, gameId, gameChannelId, type){
	sessionStorage.setItem("show","false")
	adBreak({
		type: 'preroll',
		name: toUrl,
		// beforeAd: ()=>{console.log('beforeAd2')},
		// afterAd: ()=>{console.log('afterAd2')},
		adBreakDone: (breakStatus)=>{
			if (toUrl==='Detail'){
				window.location.href = `detail.html?gameId=${gameId}&gameChannelId=${gameChannelId}`;
			}else if(toUrl==='Type'){
				window.location.href = `type.html?type=${type}&gameChannelId=${gameChannelId}`;
			}else if(toUrl === 'about'){
				window.location.href = `about_content.html?aboutContentType=${type}&gameChannelId=${gameChannelId}`;
			}else if(toUrl === 'videoDetail'){
				window.location.href = `video_detail.html?vid=${gameId}&gameChannelId=${gameChannelId}`;
			}else{
				window.location.href = `index.html?gameChannelId=${gameChannelId}`;
			}
		},
	});
}

function preAd(){
	adBreak({
		type: 'preroll',
		name: 'preroll-ad',
		adBreakDone: (breakStatus)=>{
			console.log(3,breakStatus)
		},
	});
}

function nextAd(){
	// adBreak({
	// 	type: 'next',
	// 	name: 'next-ad',
	// 	adBreakDone: (breakStatus)=>{
	// 		console.log(4,breakStatus)
	// 	},
	// });
}